macro(get_git_revision VAR_NAME)
  find_package(Git REQUIRED)
  execute_process(
    COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
    OUTPUT_VARIABLE ${VAR_NAME}
    OUTPUT_STRIP_TRAILING_WHITESPACE
    ERROR_QUIET
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  )
  if (NOT DEFINED ${VAR_NAME})
    set(${VAR_NAME} "N/A")
  endif()
endmacro()
